﻿/*
 * Copyright 2010 Marc Cesarine
 * 
 * This file is part of Ssh Commander.

 * Ssh Commander is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.

 * Ssh Commander is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with Ssh Commander.  If not, see <http://www.gnu.org/licenses/>.
 */

using System.Threading;
using System.Windows.Controls;

namespace SshCommander
{
    /// <summary>
    /// Logique d'interaction pour AccountCheck.xaml
    /// </summary>
    public partial class AccountCheck : UserControl
    {
        private ServersList serversList_v;

        public AccountCheck(ref ServersList serversList)
        {
            InitializeComponent();
            serversList_v = serversList;
        }

        private void AccountsCheckButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            foreach (Server server in serversList_v.serversList)
            {
                if (server.isTunneled)
                {
                    //On lance le traitement dans un thread spécifique (utilisation d'un pool de threads)
                    ThreadPool.QueueUserWorkItem(server.PasswordsCheckThreadPoolCallback);
                }
                else
                {
                    //On lance le traitement dans un thread spécifique (utilisation d'un pool de threads)
                    ThreadPool.QueueUserWorkItem(server.PasswordsCheckThreadPoolCallback);
                }
            }
        }
    }
}
